namespace Demo
{
    public class Authorizer
    {
        private readonly IGateway gateway;

        public Authorizer(IGateway gateway)
        {
            this.gateway = gateway;
        }

        public string Authorize(CreditCard card, double amount)
        {
            var result = gateway.Authorize((int) (amount*100), card);
            if (!result.Success) throw new AuthorizationException(result.Message);
            return result.Authorization;
        }
    }
}